package com.closer.server.api;


import com.closer.server.biz.submission.dto.SearchRequest;
import com.closer.server.biz.submission.dto.vo.SubmissionVO;
import com.closer.server.biz.problem.service.SubmissionService;
import com.closer.server.support.common.BaseResponse;
import com.closer.server.support.common.ResultUtils;
import com.mybatisflex.core.paginate.Page;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/submission")
public class SubmissionController {

    private final SubmissionService submissionService;
    public SubmissionController(SubmissionService submissionService) {
        this.submissionService = submissionService;
    }

    @PostMapping("/search")
    public BaseResponse<Page<SubmissionVO>> search(@RequestBody SearchRequest params) {
        var list = submissionService.search(params);
        return ResultUtils.success(list);
    }
}
